package com.alex.service;

import com.alex.dao.UserMapper;
import com.alex.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User getById(int id) {
        return userMapper.get(id);
    }

    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    public User getByName(String name) {
        return userMapper.queryByName(name);
    }

    @Override
    public boolean nameIsExist(String name) {
        return userMapper.queryByName(name) != null;
    }

}
